
import { _decorator, Component, Node, Graphics, CCObject, Color, UITransform, Vec2 } from 'cc';
import { GameConfig } from '../gameConfig';
const { ccclass, property } = _decorator;

/**
 * Predefined variables
 * Name = TryPla
 * DateTime = Mon Nov 15 2021 17:27:20 GMT+0800 (中国标准时间)
 * Author = mdkmarui
 * FileBasename = tryPla.ts
 * FileBasenameNoExtension = tryPla
 * URL = db://assets/secripts/ui/tryPla.ts
 * ManualUrl = https://docs.cocos.com/creator/3.3/manual/zh/
 *
 */
 
@ccclass('TryPla')
export class TryPla extends Component {
    @property(Color)
    fillColor: Color = null;

    clearFill () {
        const g = this.getComponent(Graphics); 
        g.clear();
    }

    upFill (v: Vec2) {
        const g = this.getComponent(Graphics); 
        const w = GameConfig.instance.width / 2;
        
        g.moveTo(v.x, v.y);
        g.lineTo(v.x, v.y - w);
        g.lineTo(v.x + w, v.y);
        g.lineTo(v.x, v.y);
        g.fillColor = this.fillColor;
        g.fill();
        g.stroke();
    }
}
